<template>
  <div>
    <h5>父组件向子组件传递数据和方法（provide/inject）</h5>
    <h5>name:{{name}}</h5>
    <Child />
  </div>
</template>

<script setup lang="ts">
import { provide, ref } from 'vue'
import Child from './Child.vue'
const name = ref('fatherName')
// provide(别名，要传递的数据和方法)
provide('name', name)
provide('handleClick', () => {
  name.value = 'childName'
})
</script>

<style>
</style>
